export default {
  data() {
    return {
      Students:"",
      getToIdStuData:{},
      Menus:[],
      admin:{}
    }
  },

  methods:{
    getAdminDataByid(url,id){
      this.$axios({
        method:'get',
        url:url+id,
        headers:{'Content-Type':'application/json',}
      }).then(res=>{
          this.admin=res.data.data
      }).catch(e=>{
        console.log(e)
      })
    },
    getStudentsDataReq(url){
      this.$axios({
        method:'get',
        url:url,
        headers:{'Content-Type':'application/json',}
      }).then(res=>{
        this.Students = res
      }).catch(e=>{
        console.log(e)
        this.Students=e
      })
    },

    postStuDelete(url,id){
      this.$axios({
        method:'post',
        url:url+id,
        headers:{'Content-Type':'application/json',}
      }).then(res=>{
        this.Students=res
      }).catch(e=>{
        console.log(e)
        this.Students=e
      })
    },

    getStuToId(url,id){
      this.$axios({
        method:'get',
        url:url+id,
        headers:{'Content-Type':'application/json'},
      }).then(res=>{
          this.getToIdStuData=res.data.data[id]
          console.log('adminmix')
          console.log(this.getToIdStuData)
      }).catch(e=>{
        console.log(e)
      })
    },

    getMenusData(url){
      this.$axios({
        method:'get',
        url:url,
        headers:{'Content-Type':'application/json',}
      }).then(res=>{
        this.Menus = res
      }).catch(e=>{
        console.log(e)
        this.Menus=e
      })
    },

    postMenuDelete(url,id){
      this.$axios({
        method:'post',
        url:url+id,
        headers:{'Content-Type':'application/json',}
      }).then(res=>{
        this.Menus=res
      }).catch(e=>{
        console.log(e)
        this.Menus=e
      })
    },

  },

  directives: {
    // 自动获取焦点
    focus: {
      inserted: function (el) {
        el.querySelector('input').focus()
      }
    }
  },
}